<jsp:include page="/partial/process_cache.jsp" />
<jsp:useBean id="usercache" scope="session"
	class="session.cache.UserCache" />
<%@ page import="archsw0904.controller.shopping.cart.*"%>
<%
	request.setCharacterEncoding(application
			.getInitParameter("PARAMETER_ENCODING"));

	if (!usercache.isClient()) {
		response.sendError(401,
				"You must me a valid logged-in client to view");
		return;
	}

	CartBeanServiceLocator cartBeanServiceLocator = new CartBeanServiceLocator();
	cartBeanServiceLocator.setCartBeanPortEndpointAddress(application
			.getInitParameter("CART_WEB_SERVICE_URI"));
	CartBean cartBeanService = cartBeanServiceLocator.getCartBeanPort();

	BookListVisualizationInfo cartInfo = cartBeanService
			.getBookList(usercache.getUserId());
	BookInfo books[] = cartInfo.getArrayBookInfo();
	if (books == null)
		books = new BookInfo[0];
%>
<div style="border-style: double;">
<table border="0" cellpadding="2" width="150" height="20">
	<caption><strong>Cart Summary</strong></caption>
	<tbody>
		<tr>
			<td>Total</td>
			<td><%=cartInfo.getTotalPrice()%> &euro;</td>
		</tr>
		<tr>
			<td>Items</td>
			<td><%=books.length%></td>
		</tr>
		<tr>
			<td colspan="2" align="center">
			<form method="get" action="/BookShopWeb/page/cart.jsp"
				style="margin: 0px; padding: 0px;"><input type="submit"
				value="View Cart" /></form>
			</td>
		</tr>
		<tr>
			<td colspan="2" align="center">
			<form method="post" action="/BookShopWeb/page/cart.jsp"
				style="margin: 0px; padding: 0px;"><input type="hidden"
				name="checkout" value="request" /> <input type="submit"
				value="Checkout &gt;" /></form>
			</td>
		</tr>
	</tbody>
</table>
</div>